package com.example.demo.Controller;

import com.example.demo.bean.shopclassify;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

@RestController
@Api(tags="分类管理")

@RequestMapping("/shopclassify")
public class shopclassifyController {
    @Autowired
    private com.example.demo.service.shopclassifyService shopclassifyService;
    @PostMapping("/Insertshopclassify")
    @ApiOperation(value = "增加分类信息", notes = "插入分类信息")
    @ResponseBody
    public int Insertshopclassify(shopclassify shopclassify){
         shopclassifyService.Insertshopclassify(shopclassify);
         return 1;
    }


    @PostMapping("/Deleteshopclassify")
    @ApiOperation(value = "删除分类信息", notes = "根据分类Id信息")
    @ResponseBody
    public int Deleteshopclassify(@RequestParam("shopiid") int shopiid){
         shopclassifyService.Deleteshopclassify(shopiid);
        return 1;
    }

    /**
     * 修改信息
     * @param
     * @return
     */
    @PostMapping("/Updateshopclassify")
    @ApiOperation(value = "更新分类信息", notes = "根据分类Id修改信息")
    @ResponseBody
    public int Updateshopclassify( shopclassify shopclassify) {
        shopclassifyService.Updateshopclassify(shopclassify);
        return 1;
    }

    /**
     * 显示所有数据
     * @return
     */
    @PostMapping("/ShowAllshopclassify")
    @ApiOperation(value = "获取分类信息列表", notes = "获取所有分类信息")
    @ResponseBody
    public List<shopclassify> ShowAllshopclassify() {
        return shopclassifyService.ShowAllshopclassify();
    }


    /**
     * 查询商品总数
     * @return
     */
    @PostMapping("/Totalshopclassify")
    @ApiIgnore
    @ResponseBody
    public int Totalshopclassify(){
        return shopclassifyService.Totalshopclassify();
    };
}
